import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { HttpClient, HttpParams } from '@angular/common/http';
import { BaseHttpService } from '../../../../shared/services/baseHttp.service';
import { StorageService } from '../../../../shared/services/storage.service';

/**
 * Company esg main service
 * 
 * Author: Andrei Istrate
 * Date: 22.02.2018
 */
@Injectable()
export class CompanyEsgService extends BaseHttpService {
    constructor(public http: HttpClient) {
        super();
    } 

    public getWeightMatrices(): Observable<any[]> {
        let userInfo = StorageService.get().userInfo;
        let params: HttpParams = new HttpParams();
        params = params.set('accountId', userInfo.accountId);
        return this.http.get<any[]>(this.serverUrl + '/esgratingserv/api/v1/esgratings/weightmatrices', { params: params });
    }

    public getReferenceUniverses(): Observable<any[]> {
        return this.http.get<any[]>(this.serverUrl + '/esgratingserv/api/v1/esgratings/referenceUniverses');
    }
}